#include "bullet.h"

#include <cmath>

Bullet::Bullet(Vector2f pos, Vector2f vel, const string& n) :
	Sprite(pos, vel, n), 
	distance(0)
{
	setPosition(Vector2f(X()-getFrame()->getWidth()/2, Y()-getFrame()->getHeight()/2));
}

Bullet::~Bullet()
{
	
}

float Bullet::getDistance() const
{
	return distance;
}
void Bullet::setDistance(float d)
{
	distance = d;
}

void Bullet::update()
{
	Vector2f p = getPosition();
	Vector2f v = getVelocity();

	//TODO: update the distance value and if it is exceeded set STATE_DEAD
	//setPosition(p + v * static_cast<float>(ticks) * 0.001);
	//distance += fabs((p - getPosition()).magnitude());
}
